package com.xuzao.developer.dao.impl;

import com.xuzao.developer.tools.base.BaseServiceSupport;
import com.xuzao.developer.base.model.AddressServer;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xuzao.developer.base.criteria.AddressServerCriteria;
import com.xuzao.developer.tools.entity.Pager;
import com.xuzao.developer.mapper.AddressServerMapper;
import com.xuzao.developer.dao.AddressServerDao;

import javax.annotation.Resource;

import com.xuzao.developer.dto.AddressServerDTO;
import org.springframework.stereotype.Service;


/**
 * @description 
 * @author xuzao
 * @date 2019-09-03 17:32:07
 **/
@Service("addressServerDao")
public class AddressServerDaoImpl extends BaseServiceSupport<AddressServer> implements AddressServerDao {

	@Resource
	private AddressServerMapper addressServerMapper;


	@Override
	public PageInfo<AddressServer> list(AddressServerDTO dto, Pager pager) {
		AddressServerCriteria criteria = this.assemblyQuerycond(dto);
		if (null != pager) {
			if (null != pager.getPageSize() && null != pager.getPageIndex()) {
				PageHelper.startPage(pager.getPageIndex(), pager.getPageSize());
			}
		}
		PageInfo<AddressServer> pageInfo = new PageInfo<>(this.addressServerMapper.selectByExample(criteria));
		return pageInfo;
	}

	//通用查询方法条件组装
	public AddressServerCriteria assemblyQuerycond(AddressServerDTO dto) {
		AddressServerCriteria criteria = new AddressServerCriteria();
		AddressServerCriteria.Criteria c = criteria.createCriteria();

		if (null != dto) {

		}
		return criteria;
	}
}